<?php 
	$this->display(tpl('head',true));
	$b[$_GET['type']]="layui-btn-danger";
	$d[$_GET['day']]="layui-btn-danger";
	if(!$_GET['type']){
		$b1="layui-btn-danger";
	}
?>
	<script src="/Public/global/js/colpick.js" type="text/javascript" charset="utf-8"></script>
	<style>
		.layui-form-label {
		    float: left;
		    display: block;
		    padding: 9px 15px;
		    width: 10%;
		    font-weight: 400;
		    text-align: right;
		}
		.layui-input, .layui-textarea {
		    display:  inline;
		    width: 80%;
		    padding-left: 10px;
		}
		.layui-table th{
			text-align: center;
		}
	</style>
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
	  	<legend>微信用户消息管理</legend>
	  	<div style="margin-top: 20px;margin-left: 20px;">
	  		<a href="<?php echo PLUGIN_ACTION ?>chatrecord/record/" class="layui-btn {{$b1}}">全部</a>
	  		<a href="<?php echo PLUGIN_ACTION ?>chatrecord/record/type_text" class="layui-btn <?php echo $b['text']?>">文本消息</a>
	  		<a href="<?php echo PLUGIN_ACTION ?>chatrecord/record/type_image" class="layui-btn <?php echo $b['image']?>">图片消息</a>
	  		<a href="<?php echo PLUGIN_ACTION ?>chatrecord/record/type_voice" class="layui-btn <?php echo $b['voice']?>">语音消息</a>
	  		<a href="<?php echo PLUGIN_ACTION ?>chatrecord/record/type_video" class="layui-btn <?php echo $b['video']?>">视频消息</a>
	  		<a href="<?php echo PLUGIN_ACTION ?>chatrecord/record/type_location" class="layui-btn <?php echo $b['location']?>">位置消息</a>
	  		<a href="<?php echo PLUGIN_ACTION ?>chatrecord/record/type_link" class="layui-btn <?php echo $b['link']?>">链接消息</a>
	  		<a href="<?php echo PLUGIN_ACTION ?>chatrecord/record/type_event" class="layui-btn <?php echo $b['event']?>">事件推送消息</a>
	  	</div>
	  	<div style="margin-top: 20px;margin-left: 20px; height: 45px;line-height: 45px; background-color: #ddd;">
	  		<div style="float: left;padding-left: 10px;">
	  			<?php if($_GET['type']){$type="/type_".$_GET['type'] ;} ?>
	  			<span>时间选择：</span>
	  			<span>
	  				<a href="<?php echo PLUGIN_ACTION ?>chatrecord/record<?php echo $type ?>/day_1" class="layui-btn layui-btn-normal layui-btn-sm <?php echo $d[1] ?>">今天</a>
	  			</span>
	  			<span>
	  				<a href="<?php echo PLUGIN_ACTION ?>chatrecord/record<?php echo $type ?>/day_2" class="layui-btn layui-btn-normal layui-btn-sm <?php echo $d[2] ?>">昨天</a>
	  			</span>
	  			<span>
	  				<a href="<?php echo PLUGIN_ACTION ?>chatrecord/record<?php echo $type ?>/day_3" class="layui-btn layui-btn-normal layui-btn-sm <?php echo $d[3] ?>">前天</a>
	  			</span>
	  			<span>
	  				<a href="<?php echo PLUGIN_ACTION ?>chatrecord/record<?php echo $type ?>/day_7" class="layui-btn layui-btn-normal layui-btn-sm <?php echo $d[7] ?>">最近7天</a>
	  			</span>
	  		</div>
	  		<div style="float: left; margin: 0 10px;">|</div>
	  		<div style="float: left;">
	  			<form class="layui-form" action="<?php echo PLUGIN_ACTION ?>chatrecord/record" method="get">
		  			<div style="float: left;color: #1E9FFF;">时间段选择：</div>
			  		<div  style="float: left;margin-left: 10px;">
			  			<span >
			  				开始时间：
			  			</span>
			  			<span style="margin-left: 10px;">
			  				<input name="startime" value="<?php echo $_GET['startime'] ?>" id="startime" style="padding-left: 12px;width: 100px;height: 30px;line-height: 30px;" type="text" />
			  			</span>
			  		</div>
			  		<div style="float: left;margin-left: 10px;">
			  			<span >
			  				结束时间：
			  			</span>
			  			<span style="margin-left: 10px;">
			  				<input name="endtime" value="<?php echo $_GET['endtime'] ?>" id="endtime" style="padding-left: 12px;width: 100px;height: 30px;line-height: 30px;"  type="text" />
			  			</span>
			  		</div>
			  		<div  style="float: left; margin-left: 20px; margin-top: 6px;">
			  			<input type="hidden" name="type" value="<?php echo $_GET['type'] ?>" />
			  			<button class="layui-btn layui-btn-sm layui-btn-normal">确定</button>
			  		</div>
			  	</form>
	  		</div>
	  	</div>
	</fieldset>
	<form class="layui-form" action="<?php echo PLUGIN_ACTION ?>chatrecord/del" method="post">
		<table class="layui-table">
			<thead>
				<tr>
					<th width="40"></th>
					<th width="50" align="center">ID</th>
					<th width="150" align="center">用户</th>
					<th align="center">消息类型</th>
					<th width="150" align="center">操作</th>
				</tr>
			</thead>
			<tbody>
			<?php foreach($dataDB AS $row){		?>
				<tr>
					<td align="center">
						 <input type="checkbox" name="iddb[]" value="<?php echo $row['id'] ?>">
					</td>
					<td align="center"><?php echo $row['id'] ?></td>
					<td align="center"><?php echo $row['username'] ?></td>
					<td>
						<?php if($row['msgtype']=='text') { ?>
							<table class="layui-table">
								<tbody>
									<tr>
										<td width="100">消息类型：</td>
										<td>text(文本消息)</td>
									</tr>
									<tr>
										<td colspan="2"><span style="color:red">消息内容：</span><?php echo $row['content'] ?></td>
									</tr>
									<tr>
										<td width="100">时间：</td>
										<td><?php echo date("Y-m-d H:i:s",$row['posttime']) ?></td>
									</tr>
									<tr>
										<td width="100">状态：</td>
										<td id="zhuangtai<?php echo $row['id'] ?>">
											<?php if($row['is_reply']=='1'){ ?>
											<p><span style="color: blue;">回复人:</span><?php echo $row['reply_username'] ?></p>
											<p><span style="color: blue;">回复内容:</span><?php echo $row['reply_content'] ?></p>
											<p><span style="color: blue;">回复时间:</span><?php echo formatTime($row['reply_time']) ?></p>
											<p><span style="color: blue;">微信返回信息:</span><?php echo C("errcode.".$row['reply_state_code']) ?></p>
											<?php }else{ ?>
												<?php $time=time()-$row['posttime']; $time=floor($time/3600); if($time > '48') { ?>
													<span style="color: red;">此消息已经超过了48小时，不可回复</span>
												<?php }else{ ?>
													<span style="color: green;">待回复</span>
												<?php } ?>
											<?php } ?>
										</td>
									</tr>
								</tbody>
							</table>
						<?php }elseif($row['msgtype']=='image') { ?>
							<table class="layui-table">
								<tbody>
									<tr>
									    <td width="84">消息类型:</td>
									    <td colspan="2">image(图片消息)</td>
									</tr>
									<tr>
									   <td colspan="3">
									   		<table class="layui-table">
									   			<tr>
												    <td rowspan="2">
												    	<a href="<?php echo $row['picurl'] ?>" target="_blank"><img width="100" height="60" src="<?php echo $row['picurl'] ?>" ></a>
												    </td>
												    <td width="100">MediaId:</td>
												    <td><?php echo $row['mediaid'] ?></td>
												</tr>
												<tr>
												    <td width="100">MsgId:</td>
												    <td><?php echo $row['msgid'] ?></td>
												</tr>
									   		</table>
									   </td>
									</tr>
									<tr>
										<td width="100">时间：</td>
										<td colspan="2"><?php echo date("Y-m-d H:i:s",$row['posttime']) ?></td>
									</tr>
									<tr>
										<td width="100">状态：</td>
										<td colspan="2" id="zhuangtai<?php echo $row['id'] ?>">
											<?php if($row['is_reply']=='1'){ ?>
											<p><span style="color: blue;">回复人:</span><?php echo $row['reply_username'] ?></p>
											<p><span style="color: blue;">回复内容:</span><?php echo $row['reply_content'] ?></p>
											<p><span style="color: blue;">回复时间:</span><?php echo formatTime($row['reply_time']) ?></p>
											<p><span style="color: blue;">微信返回信息:</span><?php echo C("errcode.".$row['reply_state_code']) ?></p>
											<?php }else{ ?>
												<?php $time=time()-$row['posttime']; $time=floor($time/3600); if($time > '48') { ?>
													<span style="color: red;">此消息已经超过了48小时，不可回复</span>
												<?php }else{ ?>
													<span style="color: green;">待回复</span>
												<?php } ?>
											<?php } ?>
										</td>
									</tr>
								</tbody>
							</table>
						<?php }elseif($row['msgtype']=='voice') { ?>
							<table class="layui-table">
								<tr>
								    <td width="100" >消息类型:</td>
								    <td colspan="3">voice(语音消息)</td>
								</tr>
								<tr>
								    <td width="100" colspan="2">MediaID：</td>
								    <td colspan="2"><?php echo $row['mediaid'] ?></td>
								</tr>
								<tr>
								    <td width="100">Format:</td>
								    <td><?php echo $row['format'] ?></td>
								    <td width="100">MsgID:</td>
								    <td><?php echo $row['msgid'] ?></td>
								</tr>
								<tr>
									<td  colspan="2" width="100">文件下载:</td>
									<td  colspan="2" ><a target="_blank" href="<?php echo PLUGIN_ACTION ?>Chatrecord/wxdown/mediaid_<?php echo str_replace("_","+++",$row['mediaid']);?>">点击下载</a></td>
								</tr>
								<?php if($row['content']) {?>
									<tr>
									    <td colspan="4"><span style="color: red;padding-right: 10px;">语音识别结果:</span><?php echo $row['content'] ?></td>
									</tr>
								<?php  }?>
								<tr>
									<td width="100">时间：</td>
									<td colspan="3"><?php echo date("Y-m-d H:i:s",$row['posttime']) ?></td>
								</tr>
								<tr>
										<td width="100">状态：</td>
										<td colspan="3" id="zhuangtai<?php echo $row['id'] ?>">
											<?php if($row['is_reply']=='1'){ ?>
											<p><span style="color: blue;">回复人:</span><?php echo $row['reply_username'] ?></p>
											<p><span style="color: blue;">回复内容:</span><?php echo $row['reply_content'] ?></p>
											<p><span style="color: blue;">回复时间:</span><?php echo formatTime($row['reply_time']) ?></p>
											<p><span style="color: blue;">微信返回信息:</span><?php echo C("errcode.".$row['reply_state_code']) ?></p>
											<?php }else{ ?>
												<?php $time=time()-$row['posttime']; $time=floor($time/3600); if($time > '48') { ?>
													<span style="color: red;">此消息已经超过了48小时，不可回复</span>
												<?php }else{ ?>
													<span style="color: green;">待回复</span>
												<?php } ?>
											<?php } ?>
										</td>
								</tr>
							</table>
						<?php }elseif($row['msgtype']=='video' || $row['msgtype']=='shortvideo') { ?>
							<table class="layui-table">
								<tbody>
									<tr>
									    <td width="84">消息类型:</td>
									    <td colspan="2"><?php echo $row['msgtype'] ?>(<?php if($row['msgtype']=='video'){echo '视频消息';}else{echo '小视频消息';} ?>)</td>
									</tr>
									<tr>
									   <td colspan="3">
									   		<table class="layui-table">
									   			<tr>
												    <td rowspan="3">
												    	<a href="<?php echo $row['picurl'] ?>" target="_blank"><img width="100" height="60" src="<?php echo $row['picurl'] ?>" ></a>
												    </td>
												    <td width="100">MediaId:</td>
												    <td><?php echo $row['mediaid'] ?></td>
												</tr>
												<tr>
												    <td width="100">MsgId:</td>
												    <td><?php echo $row['msgid'] ?></td>
												</tr>
												<tr>
												    <td width="100">文件下载:</td>
												    <td><a target="_blank" href="<?php echo PLUGIN_ACTION ?>Chatrecord/wxdown/mediaid_<?php echo str_replace("_","+++",$row['mediaid']);?>">点击下载</a></td>
												</tr>
									   		</table>
									   </td>
									</tr>
									<tr>
										<td width="100">时间：</td>
										<td colspan="2"><?php echo date("Y-m-d H:i:s",$row['posttime']) ?></td>
									</tr>
									<tr>
										<td width="100">状态：</td>
										<td colspan="2" id="zhuangtai<?php echo $row['id'] ?>">
											<?php if($row['is_reply']=='1'){ ?>
											<p><span style="color: blue;">回复人:</span><?php echo $row['reply_username'] ?></p>
											<p><span style="color: blue;">回复内容:</span><?php echo $row['reply_content'] ?></p>
											<p><span style="color: blue;">回复时间:</span><?php echo formatTime($row['reply_time']) ?></p>
											<p><span style="color: blue;">微信返回信息:</span><?php echo C("errcode.".$row['reply_state_code']) ?></p>
											<?php }else{ ?>
												<?php $time=time()-$row['posttime']; $time=floor($time/3600); if($time > '48') { ?>
													<span style="color: red;">此消息已经超过了48小时，不可回复</span>
												<?php }else{ ?>
													<span style="color: green;">待回复</span>
												<?php } ?>
											<?php } ?>
										</td>
									</tr>
								</tbody>
							</table>
						<?php }elseif($row['msgtype']=='location') { ?>
							<table class="layui-table">
								<tr>
								    <td width="150" >消息类型:</td>
								    <td colspan="3">location(地理位置消息)</td>
								</tr>
								<tr>
								    <td width="150">Location_X(维度):</td>
								    <td><?php echo $row['location_x'] ?></td>
								    <td width="150">Location_Y(经度):</td>
								    <td><?php echo $row['location_y'] ?></td>
								</tr>
								<tr>
								    <td width="150">Scale(缩放大小):</td>
								    <td><?php echo $row['scale'] ?></td>
								    <td width="150">Label(地理位置):</td>
								    <td><?php echo $row['label'] ?></td>
								</tr>
								<tr>
								    <td width="100">MsgId:</td>
								    <td colspan="3"><?php echo $row['msgid'] ?></td>
								</tr>
								<tr>
									<td width="100">时间：</td>
									<td colspan="3"><?php echo date("Y-m-d H:i:s",$row['posttime']) ?></td>
								</tr>
							</table>
						<?php }elseif($row['msgtype']=='link') { ?>
							<table class="layui-table">
								<tbody>
									<tr>
										<td width="100">消息类型：</td>
										<td>link(链接消息)</td>
									</tr>
									<tr>
										<td width="100">标题：</td>
										<td><a href="<?php echo $row['url'] ?>" target="_blank"><?php echo $row['title'] ?></a></td>
									</tr>
									<tr>
										<td colspan="2"><span style="color:red">消息内容：</span><?php echo $row['content'] ?></td>
									</tr>
									<tr>
										<td width="100">时间：</td>
										<td><?php echo date("Y-m-d H:i:s",$row['posttime']) ?></td>
									</tr>
									<tr>
										<td width="100">状态：</td>
										<td id="zhuangtai<?php echo $row['id'] ?>">
											<?php if($row['is_reply']=='1'){ ?>
											<p><span style="color: blue;">回复人:</span><?php echo $row['reply_username'] ?></p>
											<p><span style="color: blue;">回复内容:</span><?php echo $row['reply_content'] ?></p>
											<p><span style="color: blue;">回复时间:</span><?php echo formatTime($row['reply_time']) ?></p>
											<p><span style="color: blue;">微信返回信息:</span><?php echo C("errcode.".$row['reply_state_code']) ?></p>
											<?php }else{ ?>
												<?php $time=time()-$row['posttime']; $time=floor($time/3600); if($time > '48') { ?>
													<span style="color: red;">此消息已经超过了48小时，不可回复</span>
												<?php }else{ ?>
													<span style="color: green;">待回复</span>
												<?php } ?>
											<?php } ?>
										</td>
									</tr>
								</tbody>
							</table>
						<?php }elseif($row['msgtype']=='event') { ?>
							<?php if($row['event']=='subscribe') { ?>
								<table class="layui-table">
									<tbody>
										<tr>
											<td width="100">消息类型：</td>
											<td>subscribe(关注公众号)</td>
										</tr>
										<?php if($row['eventKey']) { ?>
											<tr>
												<td width="100">EventKey：</td>
												<td><?php echo $row['eventKey']?></td>
											</tr>
										<?php } ?>
										<?php if($row['ticket']) { ?>	
											<tr>
												<td width="100">Ticket：</td>
												<td><?php echo $row['ticket']?></td>
											</tr>
										<?php } ?>
										<tr>
											<td width="100">时间：</td>
											<td><?php echo date("Y-m-d H:i:s",$row['posttime']) ?></td>
										</tr>
									</tbody>
								</table>
							<?php }elseif($row['event']=='unsubscribe') { ?>
								<table class="layui-table">
									<tbody>
										<tr>
											<td width="100">消息类型：</td>
											<td>unsubscribe(取消关注公众号)</td>
										</tr>
										<tr>
											<td width="100">时间：</td>
											<td><?php echo date("Y-m-d H:i:s",$row['posttime']) ?></td>
										</tr>
									</tbody>
								</table>
							<?php }elseif($row['event']=='SCAN') { ?>
								<table class="layui-table">
									<tbody>
										<tr>
											<td width="100">消息类型：</td>
											<td>SCAN(扫描带参数的二维码关注的用户)</td>
										</tr>
										<?php if($row['eventKey']) { ?>
											<tr>
												<td width="100">EventKey：</td>
												<td><?php echo $row['eventKey']?></td>
											</tr>
										<?php } ?>
										<?php if($row['ticket']) { ?>	
											<tr>
												<td width="100">Ticket：</td>
												<td><?php echo $row['ticket']?></td>
											</tr>
										<?php } ?>
										<tr>
											<td width="100">时间：</td>
											<td><?php echo date("Y-m-d H:i:s",$row['posttime']) ?></td>
										</tr>
									</tbody>
								</table>
							<?php }elseif($row['event']=='LOCATION') { ?>
								<table class="layui-table">
									<tbody>
										<tr>
											<td width="100">消息类型：</td>
											<td>LOCATION(上报地理位置事件)</td>
										</tr>
										<tr>
											<td width="100">Latitude(纬度)：</td>
											<td><?php echo $row['location_x']?></td>
										</tr>
										<tr>
											<td width="100">Longitude(经度)：</td>
											<td><?php echo $row['location_y']?></td>
										</tr>
										<tr>
											<td width="100">Precision(精度)：</td>
											<td><?php echo $row['precision']?></td>
										</tr>
										<tr>
											<td width="100">时间：</td>
											<td><?php echo date("Y-m-d H:i:s",$row['posttime']) ?></td>
										</tr>
									</tbody>
								</table>
							<?php }elseif($row['event']=='CLICK') { ?>
								<table class="layui-table">
									<tbody>
										<tr>
											<td width="100">消息类型：</td>
											<td>CLICK(自定义菜单事件)</td>
										</tr>
										<tr>
											<td width="100">EventKey(事件KEY值，与自定义菜单接口中KEY值对应)：</td>
											<td><?php echo $row['eventkey']?></td>
										</tr>
										<tr>
											<td width="100">时间：</td>
											<td><?php echo date("Y-m-d H:i:s",$row['posttime']) ?></td>
										</tr>
									</tbody>
								</table>
							<?php }elseif($row['event']=='VIEW') { ?>
								<table class="layui-table">
									<tbody>
										<tr>
											<td width="100">消息类型：</td>
											<td>VIEW(自定义菜单事件)</td>
										</tr>
										<tr>
											<td width="100">EventKey(事件KEY值，设置的跳转URL)：</td>
											<td><?php echo $row['eventkey']?></td>
										</tr>
										<tr>
											<td width="100">时间：</td>
											<td><?php echo date("Y-m-d H:i:s",$row['posttime']) ?></td>
										</tr>
									</tbody>
								</table>
							<?php } ?>
						<?php } ?>
					</td>
					<td width="100" align="center">
						<?php $time=time()-$row['posttime']; $time=floor($time/3600); if($row['msgtype'] !='event' && $time < '48' && $row['is_reply']=='0') { ?>
							<a id="reply_<?php echo $row['id']?>" href="javascript:" onclick="reply('<?php echo $row['openid']?>','<?php echo $row['username'] ?>','<?php echo $row['id'] ?>')"  class="layui-btn layui-btn-sm layui-btn-normal">回复</a>
						<?php } ?>
						<a href="<?php echo PLUGIN_ACTION ?>Chatrecord/del/id_<?php echo $row['id']?>"  class="layui-btn layui-btn-sm layui-btn-danger">删除</a>
					</td>
				</tr>
			<?php } ?>
			</tbody>
		</table>
		<div class="page" style="margin-bottom: 20px; margin-top: 20px;">
			<?php echo $Get_Page ?>
		</div>
		<div class="button">
			<button class="layui-btn layui-btn-sm layui-btn-warm" onclick="return all_checkbox_check('1')">全选</button>
			<button class="layui-btn layui-btn-sm layui-btn-warm" onclick="return all_checkbox_check('-1')">反选</button>
			<button class="layui-btn layui-btn-sm layui-btn-warm" onclick="return all_checkbox_check('0')">取消选择</button>
			<button class="layui-btn layui-btn-sm layui-btn-danger" name="step" value="del">批量删除</button>
		</div>
	</form>
	<blockquote class="layui-elem-quote layui-text">
		<li>1、这里可以设置类似机器人回复微信用户提出的问题，你可以设置关键词，根据用户提出的问题中包含此关键字时，就回复对应的内容。回答不上的内容，就发给客服回复.</li>
		<li>2、排在最前面的会优先匹配。</li>
		<li>2、如果想回复图文消息，4项必填缺一不可。</li>
	</blockquote>
	<div id="reply" style="display: none;">
		<form class="layui-form" action="<?php echo PLUGIN_ACTION ?>chatrecord/reply_send" method="post">
			<table class="layui-table">
				<tbody>
					<tr>
						<td width="50">回复：</td>
						<td id="u"></td>
					</tr>
					<tr>
						<td width="50">内容</td>
						<td>
							<textarea id="send_content" name="content" class="layui-textarea"></textarea>
						</td>
					</tr>
					<tr>
						<td colspan="2" align="center">
							<input type="hidden" name="id" id="sendid" />
							<input type="hidden" name="openid" id="openid" />
							<button lay-submit lay-filter="send" class="layui-btn layui-btn-primary">提交</button>
						</td>
					</tr>
				</tbody>
			</table>
		</form>
	</div>
<script>
	var send=null;
	function reply(a,b,c){
		$('#openid').val(a);
		$('#sendid').val(c);
		$('#u').html(b);
		send=layer.open({
			type: 1,
			title: ["消息回复框","font-weight: bold;"],
			closeBtn: 1,
			maxmin: 2,
			area: '516px',
			skin: 'layui-layer-molv', //没有背景色
			shadeClose: false,
			scrollbar: false,
			content: $('#reply'),
			success: function(layero, index){
			    $.ajax({ 
			    	url: "<?php echo PLUGIN_ACTION ?>chatrecord/message_custom_typing",
			    	data: {"openid":a},
			    	dataType:'json',
			    	type:'post',
			    	success: function(){
			        	$(this).addClass("done");
			    	}
			    });
			}
		});
	}
	function all_checkbox_check(type) {
		if(document.getElementsByClassName('layui-form-checkbox') != undefined && document.getElementsByClassName('layui-form-checkbox').length > 0) {
			var class_box = document.getElementsByClassName('layui-form-checkbox');
			var ids = document.getElementsByName('iddb[]');
			if(type == "1") { //全选
				for(var i = 0; i < class_box.length; i++) {
					$(ids[i]).prop("checked", true);
					$(class_box[i]).addClass("layui-form-checked");
				}
			} else if(type == "0") { //全不选
				for(var i = 0; i < class_box.length; i++) {
					$(ids[i]).prop("checked", false);
					$(class_box[i]).removeClass("layui-form-checked");
				}
			} else if(type == "-1") { //反选
				for(var i = 0; i < class_box.length; i++) {
					if(ids[i].checked == true) {
						$(ids[i]).prop("checked", false);
					} else {
						$(ids[i]).prop("checked", true);
					}
					$(class_box[i]).toggleClass("layui-form-checked");
				}
			}
		}
		return false;
	}
	layui.config({
		version: '<?php echo  NOWTIME ?>'
	});
	layui.use(['form','table', 'upload','laydate'], function(){
	  	var $ = layui.jquery,table=layui.table;
		var form = layui.form;
		var laydate = layui.laydate;
		laydate.render({
			elem: '#startime',
			type: 'date'
		});
		laydate.render({
			elem: '#endtime',
			type: 'date'
		});
		form.on('submit(send)', function(data){
			$.ajax({ 
			    	url: "<?php echo PLUGIN_ACTION ?>chatrecord/reply_send",
			    	data:data.field,
			    	dataType:'json',
			    	type:'post',
			    	success: function(res){
			    		$('#reply_'+data.field.id).remove();
			    		$('#zhuangtai'+data.field.id).html("<span style='color:blue'>已回复</span>");
			        	layer.msg(res.text);
			        	$('#send_content').val('');
			        	layer.close(send);
			    	}
			    });
			console.log() //当前容器的全部表单字段，名值对形式：{name: value}
			return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
		});
	});
	


</script>
<?php $this->display(tpl('foot',true)); ?>